"""
作者：元明
日期：2023年10月30日
"""


def case_1():
    for i in range(1, 10):
        for j in range(1, i + 1):
            print(f"{j}*{i}={i * j}", end=" ")
        print()


def case_2():
    list1 = [1, 9, 9999, 66, 2222, 3333333333, 777, -1]
    sum = 0
    avg = 0
    max_list = list1[0]
    min_list = list1[0]
    for n in list1:
        sum += n
        avg = sum / len(list1)
        if n > max_list:
            max_list = n
        if n < min_list:
            min_list = n
    print(f"sum:{sum}")
    print(f"avg:{avg}")
    print(f"max_list:{max_list}")
    print(f"min_list:{min_list}")


# def case_3():
#     sum = 0
#     avg = 0
#     max_list = None
#     min_list = None
#     while True:
#         nums = input("请输入一个数:")
#         if nums == 'bye':
#             break
#         if nums.isdigit():
#             for i in nums:
#                 max_list = nums[0]
#                 min_list = nums[0]
#                 if max_list > i:
#                     max_list = i
#                 if min_list <= i:
#                     min_list = i
#                 i = int(i)
#                 sum += i
#     avg = sum / len(nums)
#     print(f"sum:{sum}")
#     print(f"avg:{avg}")
#     print(f"max_list:{max_list}")
#     print(f"min_list:{min_list}")


def case_4():
    nums = [1, 9, 0, 3, 99, 8, 777]
    for i in range(len(nums) - 1):
        for j in range(len(nums) - i - 1):
            if nums[j] > nums[j + 1]:
                nums[j], nums[j + 1] = nums[j + 1], nums[j]
    print(nums)


if __name__ == '__main__':
    # case_1()
    # case_2()
    # case_3()
    case_4()
